<template>
  <div>
    <classification></classification>
    <div class="bannerList">
      <el-carousel height="606px">
        <el-carousel-item v-for="(item,index) in 4" :key="item">
          <img :src="'../../../public/index_background'+index+'.jpg'" class="image" />
        </el-carousel-item>
      </el-carousel>
      <div class="listBox">
        <div class="listBoxLeft">
          <div class="listBoxLeftItem" v-for="(item,index) in list" :key="index" @click="changeItem(item,index)">
            <span>{{ item.name }}</span>
            <el-icon size="12px" color="#999">
              <ArrowRight />
            </el-icon>
          </div>
        </div>
        <div v-if="isShow" class="listBoxR">
          <div class="listBoxRight" v-for="(item,index) in classificationList" :key="index">
            <div class="title">{{ item.title }}</div>
            <el-row style="margin-bottom: 20px;">
              <el-col :span="8" class="listBoxRightItem" v-for="(itm,ind) in item.child" :key="index">
                <img :src="itm.icon" style="width: 53px;height: 45px;object-fit: cover;" />
                <a>{{ itm.name }}</a>
              </el-col>
            </el-row>
          </div>
        </div>

      </div>
    </div>

  </div>
</template>
<script lang="ts" setup>
import classification from "../../components/classification.vue";
import { reactive, ref } from "vue";
const list = reactive([
  {
    name: "热门推荐",
  },
  {
    name: "OPPO 手机",
  },
  {
    name: "一加手机",
  },
  {
    name: "平板电脑",
  },
  {
    name: "智能耳机",
  },
  {
    name: "智能穿戴",
  },
  {
    name: "原装佩戴",
  },
  {
    name: "保障服务",
  },
]);
const classificationList = reactive([{
    title:'热门推荐',
    child:[ {
    name: "OPPO Watch X2 全智能旗舰手表",
    icon: "../../../public/classification_icon.png",
  },
  {
    name: "一加平板",
    icon: "../../../public/classification_icon0.png",
  },
  {
    name: "一加 Buds Ace 2 真无线降噪蓝牙耳机",
    icon: "../../../public/classification_icon1.png",
  },
  {
    name: "OPPO Pad 3",
    icon: "../../../public/classification_icon2.png",
  },
  {
    name: "OPPO Pad 3",
    icon: "../../../public/classification_icon3.png",
  }]
}]);
const isShow = ref(false);
const changeItem = (item: any, index: number) => {
  isShow.value = !isShow.value;
};
</script>
<style lang="scss">
.bannerList {
  width: 100%;
  height: 606px;
  position: relative;
  .el-carousel__container {
    height: 606px;
    .el-carousel__item {
      height: 606px;
      .image {
        width: 100%;
        height: 100%;
        object-fit: cover;
      }
    }
  }
  .listBox {
    position: absolute;
    left: 50%;
    top: 0;
    max-width: 1312px;
    transform: translateX(-50%);
    width: 100%;
    padding-bottom: 64px;
    padding-top: 32px;
    height: 80%;
    display: flex;

    .listBoxLeft {
      width: 220px;
      height: 100%;
      background-color: #fff;
      border-radius: 6px;
      padding: 12px 0;
      margin-right: 20px;
      .listBoxLeftItem {
        display: flex;
        padding: 0 12px 0 20px;
        justify-content: space-between;
        height: 38px;
        align-items: center;
        cursor: pointer;
        span {
          font-size: 14px;
        }
      }
      .listBoxLeftItem:hover {
        background: #f7f8fa;
      }
    }
    .listBoxR {
      display: flex;
      flex-direction: column;
      .listBoxRight {
        width: 60%;
        height: 80%;
        background: #fff;
        border-radius: 6px;
        padding: 20px;
        overflow-y: scroll;
        .title {
          margin-bottom: 12px;
          font-weight: 500;
          word-spacing: 1px;
          font-size: 16px;
          line-height: 24px;
          height: 24px;
        }
        .listBoxRightItem {
          display: flex;
          align-items: center;
          padding: 8px;
          a {
            font-size: 14px;
            color: #666;
            margin-left: 8px;
          }
        }
      }
    }
  }
}
</style>